unit FormClienteConsultaUnit;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids,
  Vcl.Buttons, Vcl.ExtCtrls;

type
  TFormClienteConsulta = class(TForm)
    Panel1: TPanel;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    Panel2: TPanel;
    Edit1: TEdit;
    Label1: TLabel;
    Panel3: TPanel;
    DBGrid1: TDBGrid;
    procedure Edit1Change(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure DBGrid1DblClick(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormClienteConsulta: TFormClienteConsulta;

implementation

{$R *.dfm}

uses DataModule_Cliente, FormClienteGeralUnit, FormClienteAlteraUnit;

procedure TFormClienteConsulta.BitBtn3Click(Sender: TObject);
var
  fgeral : TFormClienteGeral;
begin
  fgeral := TFormClienteGeral.Create(self);
  with fgeral do
  begin
    try
      ShowModal;
    finally
      free;
    end;
  end;
end;

procedure TFormClienteConsulta.BitBtn4Click(Sender: TObject);
var
  faltera : TFormClienteAltera;
begin
  faltera := TFormClienteAltera.Create(self);
  with faltera do
  begin
    try
      ShowModal;
    finally
      free;
    end;
 end;
end;

procedure TFormClienteConsulta.DBGrid1DblClick(Sender: TObject);
var
  fgeral : TFormClienteGeral;
begin
  fgeral := TFormClienteGeral.Create(self);
  with fgeral do
  begin
    try
      ShowModal;
    finally
      free;
    end;
  end;
end;

procedure TFormClienteConsulta.Edit1Change(Sender: TObject);
begin

    DM_Cliente.CDSCliente.Filtered := false;
    DM_Cliente.CDSCliente.Filter := 'nome like '+QuotedStr('%'+Edit1.Text+'%');
    DM_Cliente.CDSCliente.Filtered := true;

end;

procedure TFormClienteConsulta.FormShow(Sender: TObject);
begin
  DM_Cliente.CDSCliente.Open;
end;

end.
